﻿using Senparc.Weixin.MP.Entities;

namespace BLWCMS.Core.Weixin.Api
{
    public partial class CustomMessageHandler
    {
        /// <summary>
        /// 处理文字请求
        /// </summary>
        /// <returns></returns>
        public override IResponseMessageBase OnTextRequest(RequestMessageText requestMessage)
        {
            //TODO:这里的逻辑可以交给Service处理具体信息，参考OnLocationRequest方法或/Service/LocationSercice.cs
            IResponseMessageBase responseMessage = null;
            //触发词为空
            if (requestMessage.Content == null)
            {

            }
            else if (requestMessage.Content == "为爱升级")
            {
                var strongResponseMessage = base.CreateResponseMessage<ResponseMessageText>();
                responseMessage = strongResponseMessage;
                strongResponseMessage.Content = "博龍微信管理系统强力驱动";
            }
                //文本回复
            else if (requestMessage.Content == "文本")
            {
                var strongResponseMessage = base.CreateResponseMessage<ResponseMessageText>();
                responseMessage = strongResponseMessage;
                strongResponseMessage.Content = "这是一条自定义文本回复。";
            }
                //单图文
            else if (requestMessage.Content == "单图文")
            {
                var strongResponseMessage = base.CreateResponseMessage<ResponseMessageNews>();
                responseMessage = strongResponseMessage;
                strongResponseMessage.Articles.Add(new Article()
                {
                    Title = "这是一条单图文信息！",
                    Description = "这里是单图文消息的介绍信息",
                    PicUrl = "http://pic9.nipic.com/20100910/668573_164813098586_2.jpg",
                    Url = "http://www.baidu.com"
                });
            }
                //多图文
            else if (requestMessage.Content == "多图文")
            {
                var strongResponseMessage = base.CreateResponseMessage<ResponseMessageNews>();
                responseMessage = strongResponseMessage;
                strongResponseMessage.Articles.Add(new Article()
                {
                    Title = "这是多图文的第一条信息！",
                    Description = "", //多图文描述是不会显示的，所以可以不加这个字段
                    PicUrl = "http://pic9.nipic.com/20100910/668573_164813098586_2.jpg",
                    Url = "http://www.baidu.com"
                });
                strongResponseMessage.Articles.Add(new Article()
                {
                    Title = "这是多图文的第二条信息！",
                    Description = "", //多图文描述是不会显示的，所以可以不加这个字段
                    PicUrl = "http://pic9.nipic.com/20100910/668573_164813098586_2.jpg",
                    Url = "http://www.baidu.com"
                });
            }
                //其他情况
            else
            {
                var strongResponseMessage = base.CreateResponseMessage<ResponseMessageText>();
                responseMessage = strongResponseMessage;
                strongResponseMessage.Content = "无响应请求！";
            }


            return responseMessage;
        }
    }
}
